package org.example.session;

import io.netty.channel.Channel;
import org.example.session.defaults.GenericReferenceSessionFactory;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

/**
 * @author liyishan
 * @date 2023/11/13 18:04
 * @apiNote
 */

public class GenericReferenceSessionFactoryBuilder {
    public Future<Channel> build(Configuration configuration) {
        IGenericReferenceSessionFactory genericReferenceSessionFactory = new GenericReferenceSessionFactory(configuration);
        try {
            return genericReferenceSessionFactory.openSession();
        } catch (ExecutionException | InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
